home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / GL / snurb / light.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.4 KB  |  58 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /* light.c */
  18.  
  19. #include <gl.h>
  20. #include <stdio.h>
  21. #include "light.h"
  22.  
  23.  
  24. float my_light[] = {
  25.     LCOLOR, .9, .9, .9,
  26.     POSITION,  0.0, .1, .1, 0.0,
  27.     LMNULL
  28. };
  29.  
  30.  
  31.  
  32. void make_lights(void)
  33. {
  34.     /* define material #1 */
  35.     
  36.     static float array[] = {
  37.         EMISSION, 0.1, 0.1, 0.1,
  38.         AMBIENT,  0.1, 0.1, 0.1,
  39.         DIFFUSE,  0.3, 0.3, 0.8,
  40.         SPECULAR,  0.0, 0.0, 0.9,
  41.         SHININESS, 10.0,
  42.         LMNULL
  43.     };
  44.     
  45.     lmdef(DEFMATERIAL, 1, sizeof(array), array);
  46.     
  47.     /* initialize model and light */
  48.     lmdef(DEFLIGHT,1,0,(float *)NULL);
  49.     lmdef(DEFLIGHT,2,10,my_light);
  50.     lmdef(DEFLMODEL,1,0,(float *)NULL);
  51.  
  52.     lmbind(LIGHT0, 1);
  53.     lmbind(LIGHT1, 2);
  54.     lmbind(LMODEL, 1);
  55. }
  56.  
  57.  
  58.